#!/usr/bin/python2.7
# -*- coding: utf-8 -*-

import sys

# Import UI components

import libVirgil.virgilUI as v
from PyQt4 import QtGui, QtCore

VERSION = "0.0.1B"
REVISION = "$Revision: 35 $".replace("$","") #SVN Attribute that gets updated on each check-in (we remove the $ $'s to make it readable

CATEGORY_REFERENCE = 1

#Thanks Guido
class Usage(Exception):
    def __init__(self, msg):
            self.msg = msg

def main(argv=None):
    import getopt
    if argv is None:
        argv = sys.argv
    try:
        try:
            opts, args = getopt.getopt(argv[1:], "hd:", ["help",])
        except getopt.error, msg:
             raise Usage(msg)

        app = QtGui.QApplication(sys.argv)
        w = v.virgil()
        w.show()

        for o,a in opts:
            if o in ('-d','--ddi31'):
                w.openDDI31File(a)

        sys.exit(app.exec_())

    except Usage, err:
        print >>sys.stderr, err.msg
        print >>sys.stderr, "for help use --help"
        return 2

if __name__ == "__main__":
    sys.exit(main())

